/*
 * Copyright (c) 2010 CCX(China) Co.,Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * CCX(China) Co.,Ltd. ("Confidential Information").
 * It may not be copied or reproduced in any manner without the express 
 * written permission of CCX(China) Co.,Ltd.
 *
 * Author: lilei
 * Date: 2011-7-28 ����11:38:55
 */

package com.bj.ccx.business.demo;

import Ice.ObjectPrx;

import com.bj.Person;
import com.bj.ccx.DemoBusinessPrx;
import com.bj.ccx.DemoBusinessPrxHelper;

/**
 *  ������ 
 *	
 *  @author lilei
 */
public class BusinessClient {
	
	private DemoBusinessPrx demoBusinessPrx = null;
	
    private Ice.Communicator ic = null;
	
	/**
     * 
     * @return
     * @throws UGenericException
     */
    private DemoBusinessPrx getOwnPrx(){

        if (this.demoBusinessPrx == null) {
            if (this.ic == null) {
                ic = Ice.Util.initialize();
            }
            
            ObjectPrx objPrx = this.ic.stringToProxy("demoUUID:default -h 10.0.2.128 -p 52525");
            
            this.demoBusinessPrx = DemoBusinessPrxHelper.checkedCast(objPrx);

            
        }
        return this.demoBusinessPrx;
    }
    
    
    
    @Override
    protected void finalize() throws Throwable {
        if (this.ic != null) {
            ic.destroy();
        }
        super.finalize();
    }
    
    
    public String business(String name ){
    	String returnValue = null;
    	
    	returnValue = this.getOwnPrx().business(name);
    	
    	return returnValue;
    }
    
    
    
    public String getAnalysis(Person personHolder){
    	
    	String msg = null; 
    	msg = this.getOwnPrx().getAnalysis(personHolder);
    	
    	return msg;
    }
}
